package com.zengdada.authority.mapper;

import com.zengdada.authority.model.AppPowerRoleRel;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param;
import tk.mybatis.mapper.common.Mapper;

public interface AppPowerRoleRelMapper extends Mapper<AppPowerRoleRel> {

    @Delete("delete syoauth.app_power_role_rel pr where pr.app_role_id in (select r.id from syoauth.app_role r where r.id <> #{roleId,jdbcType=VARCHAR}" +
            "start with r.id = #{roleId,jdbcType=VARCHAR} connect by prior r.id = r.parent_id) and pr.app_power_id = #{powerId,jdbcType=DECIMAL}")
    void deleteSons(@Param("roleId") String roleId, @Param("powerId") String powerId);
}